﻿/*
 * ============ [ 废土 ] ============
 *
 * [ 维护者 ]  argoran@gmail.com
 * [  状态  ]  原型
 *
 * ============ [ 注释 ] ============
 *
 * 客户端程序消息处理代码
 *
 * ==================================
 */

using LastLandClient.Core.MsgProcessor;
using LastLandClient.Data;

using Up2Link.SegString;

namespace LastLandClient.Core
{
    public class CMessage
    {
        private IMessageProcessor msgProc_;

        public void ProcessMessage(CMessageSS _msg)
        {
            switch (_msg.MsgCode)
            {
                case CConst.SERVER_MESSAGE_INVALID_USERNAME_OR_PASSWORD:
                    msgProc_ = new CMsgInvalidUsernameOrPassword();
                    break;
                case CConst.SERVER_MESSAGE_ACCOUNT_LOGGED_IN_BY_ANOTHER_CLIENT:
                    msgProc_ = new CMsgAccountLoggedInByAnotherClient();
                    break;
                case CConst.SERVER_MESSAGE_NO_COUNTRY_AVAILABLE:
                    msgProc_ = new CMsgNoCountryAvailable();
                    break;
                case CConst.SERVER_MESSAGE_NO_GRID_AVAILABLE:
                    msgProc_ = new CMsgNoGridAvailable();
                    break;
                case CConst.SERVER_MESSAGE_CLIENT_LOGGED_IN:
                    msgProc_ = new CMsgClientLoggedIn();
                    break;
                case CConst.SERVER_MESSAGE_CLIENT_NOT_LOGGED_IN:
                    msgProc_ = new CMsgClientNotLoggedIn();
                    break;
                case CConst.SERVER_MESSAGE_CLIENT_PLAYING:
                    msgProc_ = new CMsgClientPlaying();
                    break;
                case CConst.SERVER_MESSAGE_CLIENT_NOT_PLAYING:
                    msgProc_ = new CMsgClientNotPlaying();
                    break;
                case CConst.SERVER_MESSAGE_CHARACTER_DEAD:
                    msgProc_ = new CMsgCharacterDead();
                    break;
                case CConst.SERVER_MESSAGE_CHARACTER_NOT_DEAD:
                    msgProc_ = new CMsgCharacterNotDead();
                    break;
                case CConst.SERVER_MESSAGE_CHARACTER_IN_COMBAT:
                    msgProc_ = new CMsgCharacterInCombat();
                    break;
                case CConst.SERVER_MESSAGE_CHARACTER_NOT_IN_COMBAT:
                    msgProc_ = new CMsgCharacterNotInCombat();
                    break;
                case CConst.SERVER_MESSAGE_CHARACTER_HAMMER_LOW:
                    msgProc_ = new CMsgCharacterHammerLow();
                    break;
                case CConst.SERVER_MESSAGE_CHARACTER_GOLD_LOW:
                    msgProc_ = new CMsgCharacterGoldLow();
                    break;
                case CConst.SERVER_MESSAGE_GRID_IN_COMBAT:
                    msgProc_ = new CMsgGridInCombat();
                    break;
                case CConst.SERVER_MESSAGE_GRID_NOT_IN_COMBAT:
                    msgProc_ = new CMsgGridNotInCombat();
                    break;
                case CConst.SERVER_MESSAGE_GRID_HOSTILE_TERRITORY:
                    msgProc_ = new CMsgGridHostileTerritory();
                    break;
                case CConst.SERVER_MESSAGE_GRID_NOT_HOSTILE_TERRITORY:
                    msgProc_ = new CMsgGridNotHostileTerritory();
                    break;
                case CConst.SERVER_MESSAGE_GRID_NOT_TERRITORY:
                    msgProc_ = new CMsgGridNotTerritory();
                    break;
                case CConst.SERVER_MESSAGE_GRID_TERRITORY:
                    msgProc_ = new CMsgGridTerritory();
                    break;
                case CConst.SERVER_MESSAGE_GRID_HAS_CITY:
                    msgProc_ = new CMsgGridHasCity();
                    break;
                case CConst.SERVER_MESSAGE_GRID_NO_CITY:
                    msgProc_ = new CMsgGridNoCity();
                    break;
                case CConst.SERVER_MESSAGE_GRID_NO_FACILITY:
                    msgProc_ = new CMsgGridNoFacility();
                    break;
                case CConst.SERVER_MESSAGE_COUNTRY_TECH_LOW_AGRICULTURE:
                    msgProc_ = new CMsgCountryTAgricultureLow();
                    break;
                case CConst.SERVER_MESSAGE_COUNTRY_TECH_LOW_INDUSTRY:
                    msgProc_ = new CMsgCountryTIndustryLow();
                    break;
                case CConst.SERVER_MESSAGE_COUNTRY_TECH_LOW_COMMERCE:
                    msgProc_ = new CMsgCountryTCommerceLow();
                    break;
                case CConst.SERVER_MESSAGE_COUNTRY_TECH_LOW_CONSTRUCTION:
                    msgProc_ = new CMsgCountryTConstructionLow();
                    break;
                case CConst.SERVER_MESSAGE_COUNTRY_TECH_LOW_MELEE:
                    msgProc_ = new CMsgCountryTMeleeLow();
                    break;
                case CConst.SERVER_MESSAGE_COUNTRY_TECH_LOW_RANGED:
                    msgProc_ = new CMsgCountryTRangedLow();
                    break;
                case CConst.SERVER_MESSAGE_COUNTRY_TECH_LOW_SIEGE:
                    msgProc_ = new CMsgCountryTSiegeLow();
                    break;
                case CConst.SERVER_MESSAGE_COUNTRY_TECH_LOW_MOUNTED:
                    msgProc_ = new CMsgCountryTMountedLow();
                    break;
                case CConst.SERVER_MESSAGE_COMPLETE_NEW_ACCOUNT:
                    msgProc_ = new CMsgOKNewAccount();
                    break;
                case CConst.SERVER_MESSAGE_COMPLETE_CREATE_NORMAL:
                    msgProc_ = new CMsgOKCreateNormal();
                    break;
                case CConst.SERVER_MESSAGE_COMPLETE_CREATE_LEADER:
                    msgProc_ = new CMsgOKCreateLeader();
                    break;
                case CConst.SERVER_MESSAGE_COMPLETE_PLAY:
                    msgProc_ = new CMsgOKPlay();
                    break;
                case CConst.SERVER_MESSAGE_COMPLETE_LOGIN:
                    msgProc_ = new CMsgOKLogin();
                    break;
                case CConst.SERVER_MESSAGE_COMPLETE_LOGOUT:
                    msgProc_ = new CMsgOKLogout();
                    break;
                case CConst.SERVER_MESSAGE_COMPLETE_MOVE:
                    msgProc_ = new CMsgOKMove();
                    break;
                case CConst.SERVER_MESSAGE_COMPLETE_TALK:
                    msgProc_ = new CMsgOKTalk();
                    break;
                case CConst.SERVER_MESSAGE_COMPLETE_COLLECT:
                    msgProc_ = new CMsgOKCollect();
                    break;
                case CConst.SERVER_MESSAGE_COMPLETE_BUILD:
                    msgProc_ = new CMsgOKBuild();
                    break;
                case CConst.SERVER_MESSAGE_COMPLETE_BUY:
                    msgProc_ = new CMsgOKBuy();
                    break;
                case CConst.SERVER_MESSAGE_COMPLETE_ATTACK:
                    msgProc_ = new CMsgOKAttack();
                    break;
                case CConst.SERVER_MESSAGE_COMPLETE_DEFEND:
                    msgProc_ = new CMsgOKDefend();
                    break;
                case CConst.SERVER_MESSAGE_COMPLETE_RETREAT:
                    msgProc_ = new CMsgOKRetreat();
                    break;
                case CConst.SERVER_MESSAGE_COMPLETE_INFO:
                    msgProc_ = new CMsgOKInfo();
                    break;
                default:
                    msgProc_ = new CMsgDefault();
                    break;
            }
            msgProc_.ProcessMessage(_msg);
        }
    }
}
